﻿using System;
using System.Linq;
using System.Text;
using System.Collections.Generic;

namespace GDoc.Domain
{
    public class Account : BaseEntity
    {
        public Account()
        {
            Users = new List<UserRoleInAccount>();
            Groups = new List<UserGroup>();
        }

        public virtual string Name { get; set; }

        public virtual ICollection<UserRoleInAccount> Users { get; set; }

        public virtual bool IsOwner(User user)
        {
            return this.Users.Any(u => u.User == user && u.Role.Enum == RoleEnum.Owner);
        }

        public virtual ICollection<UserGroup> Groups { get; set; }
    }
}
